package com.joysuch.wwyt.risk.entity;

import com.joysuch.wwyt.core.support.AutoSetCommonFieldListener;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.hibernate.annotations.SQLDelete;
import org.hibernate.annotations.SQLDeleteAll;
import org.hibernate.annotations.Where;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;

import javax.persistence.*;
import java.io.Serializable;

import static javax.persistence.GenerationType.IDENTITY;

/**
 * @Author ZhaoQiuWei
 * @Date 2022/4/6 15:00
 */

@Data
@EntityListeners({AuditingEntityListener.class, AutoSetCommonFieldListener.class})
@Entity
@Table(name = "wwyt_risk_dynamic_config")
@SQLDelete(sql = "update wwyt_risk_dynamic_config set DELETE_FLAG = '1' where id= ?")
@SQLDeleteAll(sql = "update wwyt_risk_dynamic_config set DELETE_FLAG = '1' where id= ?")
@Where(clause = "DELETE_FLAG = '0'")
public class RiskDynamicConfig implements Serializable {

    @Id
    @GeneratedValue(strategy = IDENTITY)
    @ApiModelProperty("动态安全风险评估ID")
    private Long id;

    @ApiModelProperty("业务流程id,流程业务才有")
    private Long processId;

    @ApiModelProperty("业务名称")
    private String businessName;

    @ApiModelProperty("组件名称,流程业务才有 如作业级别")
    private String optionTypeName;

    @ApiModelProperty("组件映射名称,流程业务才有:如 动火作业级别")
    private String optionTypeProxyName;

    @ApiModelProperty("参数id,流程业务才有")
    private Long optionParamId;

    @ApiModelProperty("参数名称")
    private String optionParamName;

    @ApiModelProperty("节点,流程业务才有")
    private String node;

    @ApiModelProperty("分数")
    private Double score;

    @ApiModelProperty("类别:0报警业务 1流程业务")
    private Integer type;

    @ApiModelProperty("0启用 1关闭")
    private Integer enableFlag;

    //通用字段
    @ApiModelProperty("创建人")
    @org.springframework.data.annotation.CreatedBy
    private Long createBy;

    @ApiModelProperty("创建时间")
    @org.springframework.data.annotation.CreatedDate
    private java.time.LocalDateTime createTime;

    @ApiModelProperty("更新人")
    @org.springframework.data.annotation.LastModifiedBy
    private Long updateBy;

    @ApiModelProperty("更新时间")
    @org.springframework.data.annotation.LastModifiedDate
    private java.time.LocalDateTime updateTime;

    @ApiModelProperty("租户")
    private Long tenentId;

    @ApiModelProperty("组织机构代码")
    private String orgCode;

    @ApiModelProperty("删除标记")
    private String deleteFlag;
}
